<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>购物车 - 奢享时光</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
  <style>
    :root {
      --primary-gradient: linear-gradient(135deg, #7F00FF, #E100FF);
      --secondary-gradient: linear-gradient(135deg, #00F5A0, #00D9F5);
      --primary-color: #7F00FF;
      --secondary-color: #00F5A0;
      --accent-color: #FFE600;
      --dark-bg: #2D1B69;
      --light-bg: #6B3FA0;
      --text-light: #FFFFFF;
      --text-secondary: #E0D5FF;
      --card-bg: rgba(255, 255, 255, 0.1);
      --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
      --border-radius: 16px;
      --border: 1px solid rgba(255, 255, 255, 0.18);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      font-family: 'Noto Sans SC', 'Poppins', sans-serif;
      background: var(--dark-bg);
      color: var(--text-light);
      font-size: 14px;
      line-height: 1.5;
      overflow-x: hidden;
    }

    a {
      text-decoration: none;
      color: inherit;
    }

    button {
      font-family: inherit;
      cursor: pointer;
      border: none;
      outline: none;
    }

    .app-container {
      max-width: 480px;
      margin: 0 auto;
      min-height: 100vh;
      background: linear-gradient(180deg, var(--dark-bg), var(--light-bg));
      position: relative;
      overflow: hidden;
      padding-bottom: 150px;
    }

    /* 背景装饰 */
    .bg-decoration {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }

    .bg-circle {
      position: absolute;
      border-radius: 50%;
    }

    .bg-circle:nth-child(1) {
      width: 300px;
      height: 300px;
      top: -150px;
      right: -100px;
      background: radial-gradient(circle, rgba(225, 0, 255, 0.2), rgba(225, 0, 255, 0));
    }

    .bg-circle:nth-child(2) {
      width: 250px;
      height: 250px;
      bottom: 10%;
      left: -100px;
      background: radial-gradient(circle, rgba(0, 245, 160, 0.15), rgba(0, 245, 160, 0));
    }

    /* 顶部导航 */
    .header {
      position: sticky;
      top: 0;
      z-index: 100;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      background: rgba(45, 27, 105, 0.8);
      padding: 15px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: var(--border);
    }

    .back-button {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    .page-title {
      font-size: 18px;
      font-weight: 600;
    }

    .header-actions {
      display: flex;
      gap: 15px;
    }

    .header-actions i {
      font-size: 18px;
      color: var(--text-light);
      opacity: 0.9;
    }

    /* 内容区域 */
    .content {
      position: relative;
      z-index: 1;
      padding: 20px;
    }

    /* 购物车项目 */
    .cart-list {
      margin-bottom: 20px;
    }

    .cart-item {
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: var(--border);
      border-radius: var(--border-radius);
      padding: 15px;
      margin-bottom: 15px;
      box-shadow: var(--shadow);
      display: flex;
      position: relative;
    }

    .item-checkbox {
      position: absolute;
      width: 20px;
      height: 20px;
      top: 15px;
      left: 15px;
      z-index: 10;
      cursor: pointer;
      opacity: 0;
    }

    .checkbox-custom {
      position: absolute;
      width: 20px;
      height: 20px;
      top: 15px;
      left: 15px;
      border-radius: 50%;
      border: 2px solid rgba(255, 255, 255, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

    .item-checkbox:checked + .checkbox-custom {
      background: var(--accent-color);
      border-color: var(--accent-color);
    }

    .item-checkbox:checked + .checkbox-custom:after {
      content: '\f00c';
      font-family: 'Font Awesome 6 Free';
      font-weight: 900;
      color: var(--dark-bg);
      font-size: 12px;
    }

    .item-image {
      width: 80px;
      height: 80px;
      border-radius: 12px;
      overflow: hidden;
      margin-right: 15px;
      margin-left: 30px;
      flex-shrink: 0;
    }

    .item-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .item-details {
      flex: 1;
    }

    .item-name {
      font-size: 15px;
      font-weight: 600;
      margin-bottom: 6px;
    }

    .item-desc {
      font-size: 12px;
      color: var(--text-secondary);
      margin-bottom: 10px;
    }

    .item-options {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .item-price {
      font-size: 16px;
      font-weight: 600;
      color: var(--accent-color);
    }

    .item-price small {
      font-size: 12px;
      font-weight: normal;
      opacity: 0.8;
    }

    .quantity-selector {
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .quantity-btn {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      transition: all 0.3s ease;
    }

    .quantity-btn:active {
      background: rgba(255, 255, 255, 0.2);
    }

    .quantity-input {
      width: 30px;
      background: transparent;
      border: none;
      color: var(--text-light);
      font-size: 15px;
      text-align: center;
    }

    .item-actions {
      position: absolute;
      right: 15px;
      bottom: 15px;
      display: flex;
      gap: 10px;
    }

    .delete-btn {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #ff4d4d;
      font-size: 14px;
      transition: all 0.3s ease;
    }

    .delete-btn:active {
      background: rgba(255, 255, 255, 0.2);
    }

    /* 优惠券和促销 */
    .promotions-section {
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border: var(--border);
      border-radius: var(--border-radius);
      padding: 15px;
      margin-bottom: 15px;
      box-shadow: var(--shadow);
    }

    .promotion-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .promotion-item:last-child {
      border-bottom: none;
    }

    .promotion-label {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .promotion-tag {
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 12px;
      background: var(--accent-color);
      color: var(--dark-bg);
    }

    .promotion-title {
      font-size: 14px;
    }

    .promotion-value {
      font-size: 14px;
      color: var(--accent-color);
    }

    .promotion-action {
      display: flex;
      align-items: center;
      color: var(--text-secondary);
      font-size: 14px;
    }

    .promotion-action i {
      margin-left: 5px;
      font-size: 12px;
    }

    /* 结算栏 */
    .checkout-bar {
      position: fixed;
      bottom: 70px;
      left: 0;
      width: 100%;
      max-width: 480px;
      margin: 0 auto;
      right: 0;
      background: rgba(45, 27, 105, 0.9);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      padding: 15px 20px;
      border-top: var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      z-index: 99;
    }

    .select-all {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .select-all-label {
      font-size: 14px;
    }

    .checkout-info {
      flex: 1;
      text-align: right;
      margin-right: 15px;
    }

    .total-price {
      font-size: 18px;
      font-weight: 600;
      color: var(--accent-color);
    }

    .checkout-desc {
      font-size: 12px;
      color: var(--text-secondary);
    }

    .checkout-btn {
      padding: 10px 20px;
      background: var(--primary-gradient);
      border-radius: 100px;
      font-size: 15px;
      font-weight: 600;
      transition: all 0.3s ease;
      box-shadow: 0 5px 15px rgba(127, 0, 255, 0.3);
    }

    .checkout-btn:active {
      transform: scale(0.97);
    }

    /* 底部导航 */
    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      max-width: 480px;
      margin: 0 auto;
      background: rgba(45, 27, 105, 0.8);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border-top: var(--border);
      display: flex;
      justify-content: space-around;
      padding: 12px 0;
      z-index: 100;
    }

    .nav-button {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      color: var(--text-secondary);
      font-size: 12px;
      padding: 5px 0;
      flex: 1;
      transition: all 0.3s ease;
    }

    .nav-button i {
      font-size: 18px;
      margin-bottom: 2px;
    }

    .nav-button.active {
      color: var(--accent-color);
    }

    /* 空购物车状态 */
    .empty-cart {
      display: none;
      text-align: center;
      padding: 50px 0;
    }

    .empty-cart.active {
      display: block;
    }

    .empty-icon {
      font-size: 60px;
      color: var(--text-secondary);
      opacity: 0.5;
      margin-bottom: 20px;
    }

    .empty-text {
      font-size: 16px;
      color: var(--text-secondary);
      margin-bottom: 30px;
    }

    .shop-btn {
      display: inline-block;
      padding: 12px 30px;
      background: var(--primary-gradient);
      border-radius: 100px;
      font-size: 15px;
      font-weight: 500;
      transition: all 0.3s ease;
      box-shadow: 0 5px 15px rgba(127, 0, 255, 0.3);
    }

    .shop-btn:active {
      transform: scale(0.97);
    }

    /* 推荐商品 */
    .recommend-section {
      margin-top: 40px;
      text-align: center;
    }

    .section-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .section-title i {
      color: var(--accent-color);
    }

    .recommend-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 15px;
    }

    .recommend-item {
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(5px);
      -webkit-backdrop-filter: blur(5px);
      border: var(--border);
      border-radius: var(--border-radius);
      padding: 15px;
      transition: all 0.3s ease;
    }

    .recommend-item:active {
      transform: scale(0.98);
    }

    .recommend-image {
      width: 100%;
      aspect-ratio: 1/1;
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 10px;
    }

    .recommend-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .recommend-name {
      font-size: 14px;
      font-weight: 500;
      margin-bottom: 5px;
      text-align: left;
    }

    .recommend-price {
      font-size: 16px;
      font-weight: 600;
      color: var(--accent-color);
      text-align: left;
    }

    .add-to-cart {
      position: absolute;
      bottom: 15px;
      right: 15px;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: var(--primary-gradient);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      box-shadow: 0 3px 10px rgba(127, 0, 255, 0.3);
    }
  </style>
</head>
<body>
  <div class="app-container">
    <!-- 背景装饰 -->
    <div class="bg-decoration">
      <div class="bg-circle"></div>
      <div class="bg-circle"></div>
    </div>

    <!-- 顶部导航 -->
    <header class="header">
      <a href="index.html" class="back-button">
        <i class="fas fa-arrow-left"></i>
      </a>
      <div class="page-title">购物车</div>
      <div class="header-actions">
        <i class="fas fa-trash-alt" id="clear-cart-btn"></i>
      </div>
    </header>

    <!-- 主要内容 -->
    <main class="content">
      <!-- 购物车列表 -->
      <div class="cart-list" id="cart-list">
        <!-- 购物车项目1 -->
        <div class="cart-item">
          <input type="checkbox" class="item-checkbox" checked>
          <div class="checkbox-custom"></div>
          <div class="item-image">
            <img src="https://via.placeholder.com/160" alt="法国进口顶级护肤套装">
          </div>
          <div class="item-details">
            <div class="item-name">法国进口顶级护肤套装</div>
            <div class="item-desc">含精华、面霜、眼霜 | 30ml*3</div>
            <div class="item-options">
              <div class="item-price">¥1,280 <small>¥1,880</small></div>
              <div class="quantity-selector">
                <button class="quantity-btn minus-btn">
                  <i class="fas fa-minus"></i>
                </button>
                <input type="text" class="quantity-input" value="1" readonly>
                <button class="quantity-btn plus-btn">
                  <i class="fas fa-plus"></i>
                </button>
              </div>
            </div>
          </div>
          <div class="item-actions">
            <button class="delete-btn">
              <i class="fas fa-trash"></i>
            </button>
          </div>
        </div>

        <!-- 购物车项目2 -->
        <div class="cart-item">
          <input type="checkbox" class="item-checkbox" checked>
          <div class="checkbox-custom"></div>
          <div class="item-image">
            <img src="https://via.placeholder.com/160" alt="925纯银珍珠项链">
          </div>
          <div class="item-details">
            <div class="item-name">925纯银珍珠项链</div>
            <div class="item-desc">天然淡水珍珠 | 优雅设计</div>
            <div class="item-options">
              <div class="item-price">¥699 <small>¥999</small></div>
              <div class="quantity-selector">
                <button class="quantity-btn minus-btn">
                  <i class="fas fa-minus"></i>
                </button>
                <input type="text" class="quantity-input" value="1" readonly>
                <button class="quantity-btn plus-btn">
                  <i class="fas fa-plus"></i>
                </button>
              </div>
            </div>
          </div>
          <div class="item-actions">
            <button class="delete-btn">
              <i class="fas fa-trash"></i>
            </button>
          </div>
        </div>

        <!-- 购物车项目3 -->
        <div class="cart-item">
          <input type="checkbox" class="item-checkbox" checked>
          <div class="checkbox-custom"></div>
          <div class="item-image">
            <img src="https://via.placeholder.com/160" alt="法国香水礼盒">
          </div>
          <div class="item-details">
            <div class="item-name">法国香水礼盒</div>
            <div class="item-desc">三种香调 | 送礼精选</div>
            <div class="item-options">
              <div class="item-price">¥899 <small>¥1,599</small></div>
              <div class="quantity-selector">
                <button class="quantity-btn minus-btn">
                  <i class="fas fa-minus"></i>
                </button>
                <input type="text" class="quantity-input" value="1" readonly>
                <button class="quantity-btn plus-btn">
                  <i class="fas fa-plus"></i>
                </button>
              </div>
            </div>
          </div>
          <div class="item-actions">
            <button class="delete-btn">
              <i class="fas fa-trash"></i>
            </button>
          </div>
        </div>
      </div>

      <!-- 优惠券和促销 -->
      <section class="promotions-section">
        <div class="promotion-item">
          <div class="promotion-label">
            <span class="promotion-tag">优惠券</span>
            <span class="promotion-title">满2000减200</span>
          </div>
          <div class="promotion-action">
            3张可用 <i class="fas fa-chevron-right"></i>
          </div>
        </div>
        <div class="promotion-item">
          <div class="promotion-label">
            <span class="promotion-tag">促销</span>
            <span class="promotion-title">跨店满减</span>
          </div>
          <div class="promotion-value">-¥100</div>
        </div>
        <div class="promotion-item">
          <div class="promotion-label">
            <span class="promotion-tag">满减</span>
            <span class="promotion-title">香水品类满减</span>
          </div>
          <div class="promotion-value">-¥50</div>
        </div>
      </section>

      <!-- 空购物车状态 -->
      <div class="empty-cart" id="empty-cart">
        <div class="empty-icon">
          <i class="fas fa-shopping-cart"></i>
        </div>
        <div class="empty-text">您的购物车还是空的</div>
        <a href="index.html" class="shop-btn">
          <i class="fas fa-shopping-bag"></i>
          去购物
        </a>

        <!-- 推荐商品 -->
        <div class="recommend-section">
          <div class="section-title">
            <i class="fas fa-fire"></i>
            <span>为您推荐</span>
          </div>
          <div class="recommend-grid">
            <div class="recommend-item">
              <div class="recommend-image">
                <img src="https://via.placeholder.com/200" alt="推荐商品">
              </div>
              <div class="recommend-name">瑞士进口手表</div>
              <div class="recommend-price">¥3,999</div>
              <div class="add-to-cart">
                <i class="fas fa-plus"></i>
              </div>
            </div>
            <div class="recommend-item">
              <div class="recommend-image">
                <img src="https://via.placeholder.com/200" alt="推荐商品">
              </div>
              <div class="recommend-name">意大利真皮包</div>
              <div class="recommend-price">¥2,699</div>
              <div class="add-to-cart">
                <i class="fas fa-plus"></i>
              </div>
            </div>
            <div class="recommend-item">
              <div class="recommend-image">
                <img src="https://via.placeholder.com/200" alt="推荐商品">
              </div>
              <div class="recommend-name">纯棉睡衣套装</div>
              <div class="recommend-price">¥399</div>
              <div class="add-to-cart">
                <i class="fas fa-plus"></i>
              </div>
            </div>
            <div class="recommend-item">
              <div class="recommend-image">
                <img src="https://via.placeholder.com/200" alt="推荐商品">
              </div>
              <div class="recommend-name">水晶项链</div>
              <div class="recommend-price">¥599</div>
              <div class="add-to-cart">
                <i class="fas fa-plus"></i>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>

    <!-- 结算栏 -->
    <div class="checkout-bar" id="checkout-bar">
      <div class="select-all">
        <input type="checkbox" class="item-checkbox" id="select-all-checkbox" checked>
        <div class="checkbox-custom"></div>
        <div class="select-all-label">全选</div>
      </div>
      <div class="checkout-info">
        <div class="total-price">¥2,878</div>
        <div class="checkout-desc">总计 (已优惠¥150)</div>
      </div>
      <div class="checkout-btn">结算 (3)</div>
    </div>

    <!-- 底部导航 -->
    <nav class="bottom-nav">
      <a href="index.html" class="nav-button">
        <i class="fas fa-home"></i>
        <span>首页</span>
      </a>
      <a href="groupbuy.html" class="nav-button">
        <i class="fas fa-users"></i>
        <span>拼团</span>
      </a>
      <a href="shares.html" class="nav-button">
        <i class="fas fa-chart-line"></i>
        <span>股权</span>
      </a>
      <a href="profile.html" class="nav-button">
        <i class="fas fa-user"></i>
        <span>我的</span>
      </a>
    </nav>
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      // 购物车数量选择
      const minusBtns = document.querySelectorAll('.minus-btn');
      const plusBtns = document.querySelectorAll('.plus-btn');
      const quantityInputs = document.querySelectorAll('.quantity-input');
      
      minusBtns.forEach((btn, index) => {
        btn.addEventListener('click', function() {
          let value = parseInt(quantityInputs[index].value);
          if (value > 1) {
            quantityInputs[index].value = value - 1;
            updateTotal();
          }
        });
      });
      
      plusBtns.forEach((btn, index) => {
        btn.addEventListener('click', function() {
          let value = parseInt(quantityInputs[index].value);
          quantityInputs[index].value = value + 1;
          updateTotal();
        });
      });
      
      // 全选功能
      const selectAllCheckbox = document.getElementById('select-all-checkbox');
      const itemCheckboxes = document.querySelectorAll('.cart-item .item-checkbox');
      
      selectAllCheckbox.addEventListener('change', function() {
        const isChecked = this.checked;
        itemCheckboxes.forEach(checkbox => {
          checkbox.checked = isChecked;
        });
        updateTotal();
      });
      
      itemCheckboxes.forEach(checkbox => {
        checkbox.addEventListener('change', function() {
          updateSelectAllStatus();
          updateTotal();
        });
      });
      
      function updateSelectAllStatus() {
        let allChecked = true;
        itemCheckboxes.forEach(checkbox => {
          if (!checkbox.checked) {
            allChecked = false;
          }
        });
        selectAllCheckbox.checked = allChecked;
      }
      
      // 删除购物车项目
      const deleteBtns = document.querySelectorAll('.delete-btn');
      
      deleteBtns.forEach((btn, index) => {
        btn.addEventListener('click', function() {
          const cartItem = this.closest('.cart-item');
          cartItem.style.height = cartItem.offsetHeight + 'px';
          
          // 添加动画效果
          setTimeout(() => {
            cartItem.style.height = '0';
            cartItem.style.opacity = '0';
            cartItem.style.padding = '0';
            cartItem.style.margin = '0';
            cartItem.style.overflow = 'hidden';
            cartItem.style.transition = 'all 0.3s ease';
            
            // 移除元素
            setTimeout(() => {
              cartItem.remove();
              updateTotal();
              checkEmptyCart();
            }, 300);
          }, 10);
        });
      });
      
      // 清空购物车
      const clearCartBtn = document.getElementById('clear-cart-btn');
      
      clearCartBtn.addEventListener('click', function() {
        if (confirm('确定要清空购物车吗？')) {
          const cartItems = document.querySelectorAll('.cart-item');
          cartItems.forEach(item => {
            item.remove();
          });
          updateTotal();
          checkEmptyCart();
        }
      });
      
      // 检查购物车是否为空
      function checkEmptyCart() {
        const cartItems = document.querySelectorAll('.cart-item');
        const emptyCart = document.getElementById('empty-cart');
        const cartList = document.getElementById('cart-list');
        const checkoutBar = document.getElementById('checkout-bar');
        const promotionsSection = document.querySelector('.promotions-section');
        
        if (cartItems.length === 0) {
          emptyCart.classList.add('active');
          cartList.style.display = 'none';
          checkoutBar.style.display = 'none';
          promotionsSection.style.display = 'none';
        } else {
          emptyCart.classList.remove('active');
          cartList.style.display = 'block';
          checkoutBar.style.display = 'flex';
          promotionsSection.style.display = 'block';
        }
      }
      
      // 更新总价
      function updateTotal() {
        let total = 0;
        let count = 0;
        
        itemCheckboxes.forEach((checkbox, index) => {
          if (checkbox.checked) {
            const priceText = checkbox.closest('.cart-item').querySelector('.item-price').textContent;
            const price = parseFloat(priceText.replace('¥', '').replace(',', '').split(' ')[0]);
            const quantity = parseInt(quantityInputs[index].value);
            
            total += price * quantity;
            count += quantity;
          }
        });
        
        // 应用优惠
        if (total >= 2000) {
          total -= 150; // 优惠金额
        }
        
        const totalPriceElement = document.querySelector('.total-price');
        const checkoutBtn = document.querySelector('.checkout-btn');
        
        totalPriceElement.textContent = '¥' + total.toLocaleString();
        checkoutBtn.textContent = `结算 (${count})`;
      }
      
      // 结算按钮
      const checkoutBtn = document.querySelector('.checkout-btn');
      
      checkoutBtn.addEventListener('click', function() {
        let hasSelected = false;
        itemCheckboxes.forEach(checkbox => {
          if (checkbox.checked) {
            hasSelected = true;
          }
        });
        
        if (hasSelected) {
          alert('即将前往结算页面！');
          // 这里可以添加跳转到结算页面的代码
        } else {
          alert('请先选择要结算的商品');
        }
      });
      
      // 推荐商品添加到购物车
      const addToCartBtns = document.querySelectorAll('.add-to-cart');
      
      addToCartBtns.forEach(btn => {
        btn.addEventListener('click', function() {
          const recommendItem = this.closest('.recommend-item');
          const productName = recommendItem.querySelector('.recommend-name').textContent;
          const productPrice = recommendItem.querySelector('.recommend-price').textContent;
          const productImage = recommendItem.querySelector('img').src;
          
          alert(`已将"${productName}"添加到购物车！`);
          // 实际项目中，这里可以添加真正将商品添加到购物车的逻辑
        });
      });
      
      // 初始化
      checkEmptyCart();
      updateTotal();
      
      // 页面加载动画
      const cartItems = document.querySelectorAll('.cart-item');
      cartItems.forEach((item, index) => {
        item.style.opacity = '0';
        item.style.transform = 'translateY(20px)';
        item.style.transition = `opacity 0.5s ease, transform 0.5s ease`;
        
        setTimeout(() => {
          item.style.opacity = '1';
          item.style.transform = 'translateY(0)';
        }, 100 + (index * 150));
      });
    });
  </script>
</body>
</html> 